#pragma once

#include <D3D11.h>
#include <D3DX11.h>
#include <d3dx11effect.h>
#include <xnamath.h>

struct Particle
{
	XMFLOAT4 pos;
	XMFLOAT4 direction;
	XMFLOAT4 params;
};

class PSSmoke
{
	public:
		PSSmoke();
		~PSSmoke();

		void init(ID3D11Device* g_device, ID3D11DeviceContext* g_context, ID3DX11Effect* fx);
		void draw(CXMMATRIX mVP, const XMFLOAT4& pos, float dt);
		void Update(float dt);

		void setDiscard(bool v) { bDiscard = v; }
		void setActive(bool v) { bActive = v; }
	
		void setPosition(float x, float y, float z);
		void setPosition(XMFLOAT3 p);
		XMFLOAT3 getPosition() { return m_position; }

	private:

		bool bActive;
		bool bDiscard;
		bool  bFirstRun;
		
		float time;

		ID3D11Device*			g_device;
		ID3D11DeviceContext*	g_context;

		ID3D11ShaderResourceView* srv_noise_texture;
		ID3D11ShaderResourceView* srv_fire_texture;
		ID3D11Buffer*	vb_init;
		ID3D11Buffer*	vb_elements;
		ID3D11Buffer*	vb_elements_2;
			
		XMFLOAT3 m_position;

		ID3DX11Effect*	m_fx;

		ID3D11InputLayout* IA_Smoke;

		static const unsigned int MAX_ELEMENTS = 60000;
	
		static const unsigned int SMOKE_GENERATOR = 0;
		static const unsigned int SMOKE_MAIN = 1;
		static const unsigned int SMOKE_SIDE = 2;


};

